<!--
Author: W3layouts
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE html>
<html>
<head>
    <title>忘记密码</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="忘记密码" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
    <!-- Custom Theme files -->
    <link href="__STATIC__/home/login/css/font-awesome.min.css" rel="stylesheet" type="text/css" media="all">
    <link href="__STATIC__/home/login/css/snow.css" rel="stylesheet" type="text/css" media="all" />
    <link href="__STATIC__/home/login/css/style.css" rel="stylesheet" type="text/css" media="all" />
    <link rel="stylesheet" href="__STATIC__/home/js/layer/theme/default/layer.css">
    <link rel="shortcut icon" href="__STATIC__/home/index/picture/2.png" type="image/x-icon">
    <style>
        .sp1{
            color: white;
        }
    </style>
</head>
<body>
<div class="snow-container">
    <div class="snow foreground"></div>
    <div class="snow foreground layered"></div>
    <div class="snow middleground"></div>
    <div class="snow middleground layered"></div>
    <div class="snow background"></div>
    <div class="snow background layered"></div>
</div>
<div class="top-buttons-agileinfo">
    <a href="{:url('home/index/index')}">返回首页</a>
</div>

<h1>忘记密码
</h1>
<div class="main-agileits">
    <!--form-stars-here-->
    <div class="form-w3-agile">
        <h2 class="sub-agileits-w3layouts">找回密码</h2>
        <form action="" method="post" id="forms">
            <input type="text" name="mobile" placeholder="手机号码" />
            <input type="text" name="verify_code" placeholder="验证码" />
            <a href="javascript:;"><span type="button" id="btn" onclick="submit(this)" class="sp1" >发送验证码</span></a>
            <input type="password" name="user_pwd" placeholder="新密码" />
        </form>
            <div class="submit-w3l">
                <input type="submit"  onclick="btn()" value="确定">
            </div>

    </div>
</div>
<!--//form-ends-here-->
<!-- copyright -->
<div class="copyright w3-agile">
    <p>  © 2017 Internship Sign In & Sign Up Form . All rights reserved | Design by chuangxuexi</p>
</div>

<script src="__STATIC__/home/js/jquery.min.js"></script>
<script src="__STATIC__/home/js/layer/layer.js"></script>

<script>
    function submit(obj) {
        $.ajax({
            'type':'post',
//            'url':"http://127.0.0.1/new_tp5/public/index.php/home/users/send_sms_code",
            'url':"{:url('home/users/send_sms_code')}",
            'data':{
                'mobile' : $("input[name='mobile']").val()
            },
            'success':function (result) {
                console.log(result);
            },
            'error':function () {
                console.log('error');
            }
        })
    }


    function btn() {
        $.ajax({
            'type':'post',
//            'url':"http://127.0.0.1/new_tp5/public/index.php/home/users/toForget",
            'url':"{:url('home/users/toForget')}",
            'data':$("#forms").serialize(),
            'success':function (data) {

                if(data ==  0){
                    layer.msg('修改成功！！', {icon: 1});
                    setTimeout(function(){
                        window.location.href=("{:url('home/users/login')}");
                    },2000);

                }else if(data == 1){

                    layer.msg('请填写完整信息！！', {icon: 5});

                }else if(data == 2){
                    layer.msg('验证码错误！！', {icon: 5});
                }else if(data == 3){
                    layer.msg('用户不存在或者账号错误！！', {icon: 5});
                }else if(data == 4){
                    layer.msg('修改失败！！', {icon: 5});
                }

            }
        })
    }
</script>
</body>
</html>